package 工厂.factory;

import 工厂.service.Shape;
import 工厂.service.impl.CircleShape;
import 工厂.service.impl.RectangleShape;
import 工厂.service.impl.SquareShape;

/**
 * @Author Klys
 * @Date 2023/6/19 15:18
 * @Description
 * @Version 1.0
 */
public class ShapeFactory {

    public Shape getInstance(String type) {
        if (type == null) {
            return null;
        }
        if (type.equals("三角形")) {
            return new SquareShape();
        }
        if (type.equals("正方形")) {
            return new SquareShape();
        }
        if (type.equals("圆形")) {
            return new CircleShape();
        }
        return null;
    }
}
